#include "ctrldialog.h"
#include "ui_ctrldialog.h"
#include "mainwindow.h"

ctrlDialog::ctrlDialog(MainWindow * window, CRobotController * ctrl, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ctrlDialog)
{
    ui->setupUi(this);

    mpMainWindow = window;
    mpCtrl = ctrl;

    connect(ui->startBtn, SIGNAL(clicked()), mpMainWindow, SLOT(startController()));
    connect(ui->stopBtn, SIGNAL(clicked()), mpMainWindow, SLOT(stopController()));
    connect(ui->runBtn, SIGNAL(clicked()), mpMainWindow, SLOT(runController()));
    connect(ui->pauseBtn, SIGNAL(clicked()), mpMainWindow, SLOT(pauseController()));
    connect(ui->showMonitorBtn, SIGNAL(clicked()),mpCtrl, SLOT(showMonitor()));
    connect(ui->helloBtn, SIGNAL(clicked()), mpCtrl, SLOT(sayHello()));
    connect(ui->smileBtn, SIGNAL(clicked()), mpCtrl, SLOT(smile()));
    connect(ui->awkwardBtn, SIGNAL(clicked()), mpCtrl, SLOT(awkward()));
    connect(ui->encourageBtn, SIGNAL(clicked()), mpCtrl, SLOT(encourage()));
}

ctrlDialog::~ctrlDialog()
{
    disconnect(ui->startBtn, SIGNAL(clicked()), mpMainWindow, SLOT(startController()));
    disconnect(ui->stopBtn, SIGNAL(clicked()), mpMainWindow, SLOT(stopController()));
    disconnect(ui->runBtn, SIGNAL(clicked()), mpMainWindow, SLOT(runController()));
    disconnect(ui->pauseBtn, SIGNAL(clicked()), mpMainWindow, SLOT(pauseController()));
    disconnect(ui->showMonitorBtn, SIGNAL(clicked()),mpCtrl, SLOT(showMonitor()));
    disconnect(ui->helloBtn, SIGNAL(clicked()), mpCtrl, SLOT(sayHello()));
    disconnect(ui->smileBtn, SIGNAL(clicked()), mpCtrl, SLOT(smile()));
    disconnect(ui->awkwardBtn, SIGNAL(clicked()), mpCtrl, SLOT(awkward()));
    disconnect(ui->encourageBtn, SIGNAL(clicked()), mpCtrl, SLOT(encourage()));

    delete ui;
}
